package com.zcx.qshop.activity;

import android.os.Bundle;
import android.widget.TextView;

import com.zcx.helper.bound.BoundView;
import com.zcx.helper.pager.Carousel;
import com.zcx.qshop.R;
import com.zcx.qshop.conn.JsonGoodinfoAsyGet;
import com.zcx.qshop.view.PicurlDetailBannerView;
import com.zcx.qshop.view.TitleView;

/**
 * Created by Administrator on 2015/9/10 0010.
 */
public class PicurlDetailActivity extends QSActivity {

    @BoundView(R.id.title_view) private TitleView titleView;

    @BoundView(R.id.picurl_detail_banner_view) private PicurlDetailBannerView picurlDetailBannerView;

    @BoundView(R.id.picurl_detail_count) private TextView count;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_picurl_detail);

        titleView.showStyle(TitleView.Style.FULL);

        titleView.showType(TitleView.Type.BACK_TWO, TitleView.Type.NAME_ONE);

        titleView.setTitleName("图片详情");

        titleView.setOnTitleItemClickListener(new TitleView.OnTitleItemClickListener() {

            @Override
            public void onBackClick() {

                finish();

            }

        });

        final JsonGoodinfoAsyGet.Info info = (JsonGoodinfoAsyGet.Info) getIntent().getSerializableExtra("Info");

        picurlDetailBannerView.setItemList(info.picurls);

        picurlDetailBannerView.setOnCarouselItemListener(new Carousel.OnCarouselItemListener<JsonGoodinfoAsyGet.Info.Picurl>() {

            @Override
            public void onCarouselItemSelected(int position, JsonGoodinfoAsyGet.Info.Picurl picurl) {

                count.setText((position + 1) + "/" + info.picurls.size());

            }

        });

        count.setText("1/" + info.picurls.size());

    }

}
